package com.mindskip.xzs.service.impl;

import com.mindskip.xzs.domain.WxSafetyRainingRecord;
import com.mindskip.xzs.domain.WxVehicleInspection;
import com.mindskip.xzs.domain.enums.WxVehicleInspectionStatusEnum;
import com.mindskip.xzs.repositoryds2.WxSafetyRainingRecordMapper;
import com.mindskip.xzs.service.WxSafetyRainingRecordService;
import com.mindskip.xzs.utility.ModelMapperSingle;
import com.mindskip.xzs.viewmodel.wx.student.user.WxSafetyRainingRecordUpdateVM;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @Author zhangshunan
 * @Date 2021/11/25
 */
@Service
public class WxSafetyRainingRecordServiceImpl implements WxSafetyRainingRecordService {
    protected final static ModelMapper modelMapper = ModelMapperSingle.Instance();

    @Resource
    WxSafetyRainingRecordMapper wxSafetyRainingRecordMapper;

    @Override
    public void add(WxSafetyRainingRecordUpdateVM model) {
        Date now = new Date();
        WxSafetyRainingRecord obj = new WxSafetyRainingRecord();
        modelMapper.map(model,obj);
        obj.setTrainTime(now);
        obj.setCreateTime(now);
        obj.setUpdateTime(now);
        obj.setValid(WxVehicleInspectionStatusEnum.VALID.getCode());
        wxSafetyRainingRecordMapper.insertSelective(obj);
    }

    @Override
    public WxSafetyRainingRecord getOneRecordByPhone(String phone) {
        return wxSafetyRainingRecordMapper.getOneRecordByPhone(phone);
    }


    @Override
    public int deleteById(Integer id) {
        return 0;
    }

    @Override
    public int insert(WxSafetyRainingRecord record) {
        return 0;
    }

    @Override
    public int insertByFilter(WxSafetyRainingRecord record) {
        return 0;
    }

    @Override
    public WxSafetyRainingRecord selectById(Integer id) {
        return null;
    }

    @Override
    public WxSafetyRainingRecord selectById(Long id) {
        return null;
    }

    @Override
    public int updateByIdFilter(WxSafetyRainingRecord record) {
        return 0;
    }

    @Override
    public int updateById(WxSafetyRainingRecord record) {
        return 0;
    }
}
